cell recognition and text extraction algorithm